/**
 * Created by Administrator on 2015/1/11.
 */

var Setting = require('../../models/setting.js');
function SettingService (){
}

SettingService.prototype.saveData = function (data) {
    //保存设置信息
    //挑战成功百分比
    var succPct = data.succPct;
    if(succPct != undefined){
        Setting.set('succPct', Number(succPct));
    }

    //破纪录获悬赏分比例
    var breakRecordPct = data.breakRecordPct;
    if(breakRecordPct != undefined){
        Setting.set('breakRecordPct', Number(breakRecordPct));
    }

    //每题默认分数
    var score = data.score;
    if(score != undefined){
        Setting.set('score', Number(score));
    }

    //最少参战人数
    var minNum = data.minNum;
    if(minNum != undefined){
        Setting.set('minNum', Number(minNum));
    }

    //最多参战人数
    var maxNum = data.maxNum;
    if(maxNum != undefined){
        Setting.set('maxNum', Number(maxNum));
    }

    //参战报名积分
    var enrollScore = data.enrollScore;
    if(enrollScore != undefined){
        Setting.set('enrollScore', Number(enrollScore));
    }

    //题库试卷数量
    var paperNum = data.paperNum;
    if(paperNum != undefined){
        Setting.set('paperNum', Number(paperNum));
    }

    //试卷题目数量
    /*var questionNum = data.questionNum;
    if(questionNum != undefined){
        Setting.set('questionNum', Number(questionNum));
    }*/
}
module.exports = SettingService;
